package com.whcstar.springcloud.eurekaserviceprovide.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.cloud.client.discovery.DiscoveryClient;

@RestController
@RequestMapping("/operate/")
public class OperateController {

    private static Logger logger = LoggerFactory.getLogger(OperateController.class);
    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping("add")
    public Integer add(Integer a, Integer b) throws InterruptedException {
        logger.info("---- call serviceProvider ----");
        Thread.sleep(50000l);
        return a + b;
    }

    @RequestMapping("sub")
    public Integer sub(Integer a, Integer b) {
        logger.info("---- call serviceProvider ----");
        return a - b;
    }
}
